package com.bycx.system.service.impl;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bycx.core.exception.BusinessException;
import com.bycx.core.service.BaseService;
import com.bycx.core.util.BeanUtil;
import com.bycx.core.util.DateUtils;
import com.bycx.core.util.StringUtils;
import com.bycx.system.dao.mapper.ASysAppVersionsDtoMapper;
import com.bycx.system.mapper.ASysAppVersionsMapper;
import com.bycx.system.model.ASysAppVersions;
import com.bycx.system.service.IASysAppVersionsService;

@Service
public class ASysAppVersionsServiceImpl implements IASysAppVersionsService {
	@Autowired
	private ASysAppVersionsMapper aSysAppVersionsMapper;
	@Autowired
	private ASysAppVersionsDtoMapper aSysAppVersionsDtoMapper;

	@Override
	public ASysAppVersions get(Map<String, Object> map) {
		return aSysAppVersionsMapper.get(map);
	}

	@Override
	public List<ASysAppVersions> getList(Map<String, Object> map) {
		
		return aSysAppVersionsDtoMapper.getVersionsList(map);
	}
	

	/**
	 * 获取最新的app下载信息
	 */
	@Override
	public ASysAppVersions queryNewVersion(ASysAppVersions aSysAppVersions) {
		if (null == aSysAppVersions) {
			throw new BusinessException("贷款参数不能为空", "100002");
		}
		// app类型为空 适用类型为空
		if (StringUtils.isEmpty(aSysAppVersions.getOsType()) || StringUtils.isEmpty(aSysAppVersions.getApplyType())) {
			throw new BusinessException("参数不合法", "100001");
		}
		ASysAppVersions newVersion = aSysAppVersionsDtoMapper.queryNewVersion(aSysAppVersions);
		if(null != newVersion){			
			newVersion.setOnlineDate(DateUtils.strToGmt(newVersion.getOnlineDate(), "yyyy-MM-dd"));
		}
		return newVersion;
	}

	@Override
	public void setBaseMapper() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public ASysAppVersions getByPrimaryKey(Serializable primaryKey) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ASysAppVersions get(String propName, String value) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ASysAppVersions> getList(String propName, String value) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void updateByPrimaryKey(ASysAppVersions t) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void deleteByPrimaryKey(Serializable primaryKey) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void deleteObj(List<ASysAppVersions> list) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void save(ASysAppVersions t) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void delete(List<String> ids) {
		// TODO Auto-generated method stub
		
	}
}
